package com.press.services;

import com.press.bean.ContentBean;
import com.press.mapper.DetailsMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by YIJIE on 2016/10/19.
 */
@Service("detailsService")
public class DetailsService {
    @Resource(name = "detailsMapper")
    private DetailsMapper detailsMapper;

    public DetailsMapper getDetailsMapper() {
        return detailsMapper;
    }

    public void setDetailsMapper(DetailsMapper detailsMapper) {
        this.detailsMapper = detailsMapper;
    }

    public ContentBean getContentById(String content_id) {
        detailsMapper.updatewatched(content_id);
        return detailsMapper.getContentById(content_id);
    }

    public List<ContentBean> getTop() {
        return detailsMapper.getTop();
    }

    public List<ContentBean> getRecommend() {
        return detailsMapper.getRecommend();
    }

    public ContentBean getLastContent(String content_id) {
        return detailsMapper.getLast(content_id);
    }

    public ContentBean getNextContent(String content_id) {
        return detailsMapper.getNext(content_id);
    }

    public List<ContentBean> getRelated(String content_id) {
        return detailsMapper.getRelated(content_id);
    }
}
